package aex.service;



import java.io.Serializable;
import java.util.LinkedHashMap;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import aex.dao.CommentTherapyDao;
import aex.domain.CommentTherapy;
import aex.util.PageBean;



@Transactional(readOnly = false)
@Service(CommentTherapyService.SERVICE_NAME)

public class CommentTherapyService  {

	
	public static final String SERVICE_NAME="aex.service.CommentTherapyService";
	/**
	 * 以注解的形式让spring为我们注入dao的实现类
	 */
	@Resource(name = CommentTherapyDao.SERVICE_NAME)
	public CommentTherapyDao dao;
	
	public CommentTherapyService() {
		
	}
	public CommentTherapy findByID(Serializable id) {
		return dao.findObjectByID(Integer.parseInt(id+""));
	}
	public void deleteById(Serializable id) {
		dao.deleteObjectByIDs(Integer.parseInt(id+""));
	}
	public void save(CommentTherapy obj) {
		dao.save(obj);
	}
	public void update(CommentTherapy obj) {
		dao.merge(obj);
	}
	public PageBean<CommentTherapy> findByCategory(
			PageBean<CommentTherapy> pageBean, int id) {
		LinkedHashMap<String, String> orderby=new LinkedHashMap<String, String>();
		orderby.put("tName.ctTime", "desc");
		return dao.findPageBean("and tName.therapy="+id, null, orderby, pageBean);
	}
}
